﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Reflection;
using Budgeter.Properties;

namespace Budgeter
{
    public static class Util
    {

        public static T CreateObject<T>(string name, params object[] constructorArgs) where T:class
        {
            foreach (Assembly asm in AppDomain.CurrentDomain.GetAssemblies())
            {
                foreach (Type typ in asm.GetTypes())
                {
                    if (typ.FullName == name)
                        return (T) Activator.CreateInstance(typ, constructorArgs);
                }
            }
            throw new ArgumentException("Class not found.");
        }

    }
}